﻿@model CategoryModel
@{
    Layout = "~/Views/Shared/_ColumnsTwo.cshtml";
    Html.AddTitleParts(!String.IsNullOrEmpty(Model.MetaTitle) ? Model.MetaTitle : Model.Name);
    Html.AddMetaDescriptionParts(Model.MetaDescription);
    Html.AddMetaKeywordParts(Model.MetaKeywords);

    var canonicalUrlsEnabled = EngineContext.Current.Resolve<SeoSettings>().CanonicalUrlsEnabled;
    if (canonicalUrlsEnabled)
    {
        var categoryUrl = Url.RouteUrl("Category", new { SeName = Model.SeName }, this.Request.Url.Scheme);
        Html.AddCanonicalUrlParts(categoryUrl);
    }

    var breadcrumbDelimiter = EngineContext.Current.Resolve<CommonSettings>().BreadcrumbDelimiter;
}
@using Nop.Core.Domain.Common;
@using Nop.Core.Domain.Seo;
@using Nop.Core.Infrastructure;
@using Nop.Web.Models.Catalog;
@using Nop.Web.Extensions;
@*category breadcrumb*@
@if (Model.DisplayCategoryBreadcrumb)
{
    <div>
        <ol class="breadcrumb">
            <li><a href="@Url.RouteUrl("HomePage")" title="@T("Categories.Breadcrumb.Top")">@T("Categories.Breadcrumb.Top")</a></li>
            @foreach (var cat in Model.CategoryBreadcrumb)
            {
                var isLastCategory = cat.Id == Model.Id;
            
                if (isLastCategory)
                {   
                    <li class="active">@cat.Name</li>
                }
                else
                {
                    <li><a href="@Url.RouteUrl("Category", new { SeName = cat.SeName })" title="@cat.Name">@cat.Name</a></li>
                }
            
            }
        </ol>
    </div>

    @Html.Widget("categorydetails_after_breadcrumb")
}
<div class="page category-page">
    <div class="panel panel-default form-panel">
        <div class="panel-heading">
            <h3>@Model.Name</h3>
        </div>
        <div class="panel-body">
            <div class="page-body">
        @Html.Widget("categorydetails_top")
        @*description*@
        @if (!String.IsNullOrWhiteSpace(Model.Description))
        {
            <div class="category-description">
                @Html.Raw(Model.Description)
            </div>
        }
        @Html.Widget("categorydetails_before_subcategories")
        @*subcategories*@
        @if (Model.SubCategories.Count > 0)
        {
            <div class="row">
                
                @foreach (var item in Model.SubCategories)
                {
                    <div class="col-md-3">
                        
                    
                        <div class="item-box">
                            <div class="offer offer-default pull-text-center">
                                <div class="category-ash-box">
                                    <h2 class="product-title">
                                        <a href="@Url.RouteUrl("Category", new { SeName = item.SeName })" title="@item.PictureModel.Title">
                                            @item.Name</a>
                                    </h2>
                                </div>
                                <div class="picture">
                                    <a href="@Url.RouteUrl("Category", new { SeName = item.SeName })" title="@item.PictureModel.Title">
                                        <img alt="@item.PictureModel.AlternateText" src="@item.PictureModel.ImageUrl"
                                             title="@item.PictureModel.Title" /></a>
                                </div>
                            </div>
                        </div>
                    </div>

                }
            </div>
        }
        @Html.Widget("categorydetails_before_featured_products")
        @*featured products*@
        @if (Model.FeaturedProducts.Count > 0)
        {
            @*<div class="product-grid featured-product-grid">
                <div class="title">
                    <strong>@T("Products.FeaturedProducts")</strong>
                </div>
                <div>
                    @foreach (var item in Model.FeaturedProducts)
                    {
                        <div class="item-box">
                            @Html.Partial("_ProductBox", item)
                        </div>
                    }
                </div>
            </div>*@


            <div class="product-grid home-page-product-grid">
                <div class="title mid-content-title">
                    <strong>@T("Products.FeaturedProducts")</strong>
                    <span class="pull-right">
                        <a class="title-carousel-control" href="#carousel-example-generic-homepage-product" data-slide="prev">
                            <i class="fa fa-angle-left"></i>
                        </a>
                        <a class="title-carousel-control" href="#carousel-example-generic-homepage-product" data-slide="next">
                            <i class="fa fa-angle-right"></i>
                        </a>

                    </span>

                </div>
        
                
        

                <div id="carousel-example-generic-homepage-product" class="carousel slide" data-ride="carousel">
                    <!-- Indicators -->
    

                    <!-- Wrapper for slides -->
                    <div class="carousel-inner">
                        @{
                            var ci = 0;
                        } 
                        @foreach (var item in Model.FeaturedProducts)
                        {
                            if(ci==0)
                            {
                                @:<div class="item active">
                                @:<div class="row box-products" >
                            }else if(ci%2==0){
                                @:<div class="item">
                                @:<div class="row box-products" >
                            }
                    
                            <div class="col-md-6">
                                <div class="offer offer-default silde-show-offer pull-text-center">
                                    @Html.Partial("_ProductBox", item)
                                </div>
                            </div>
                    

                            if(ci%2==1){
                                @:</div>
                                @:</div>
                            }
                            ci++;
                        }
                        @if(ci%2==1){
                            @:</div>
                            @:</div>
                        }
        
                    </div>


                </div>
            </div>


        }
        @Html.Widget("categorydetails_after_featured_products")
                <div class="row">
                    <div class="col-md-12">
                                      
            
                        <div class="product-selectors clearfix">
                            
                                
                            
                            @*view mode*@
                            @if (Model.PagingFilteringContext.AllowProductViewModeChanging && Model.Products.Count > 0)
                            {
                                <div class="col-md-4 pull-text-center">
                                    <div class="row">
                                        <div class="col-md-4 remove_right_padding">
                                            <span>@T("Categories.ViewMode")</span>
                                        </div>
                                        <div class="col-md-5 remove_left_padding">
                                            @Html.DropDownList("products-viewmode", Model.PagingFilteringContext.AvailableViewModes, new { @class = "form-control dropdown-filter", onchange = "setLocation(this.value);" })
                                        </div>
                                    </div>
                                </div>
                            }
                            @*sorting*@
                            @if (Model.PagingFilteringContext.AllowProductSorting && Model.Products.Count > 0)
                            {
                                <div class="col-md-4 pull-text-center">
                                    <div class="row">
                                        <div class="col-md-4 remove_right_padding">
                                            <span>@T("Categories.OrderBy")</span>
                                        </div>
                                        <div class="col-md-8 remove_left_padding">
                                            @Html.DropDownList("products-orderby", Model.PagingFilteringContext.AvailableSortOptions, new { @class = "form-control dropdown-filter", onchange = "setLocation(this.value);" })
                                        </div>
                                    </div>                  
                                </div>
                            }
                            @*page size*@
                            @if (Model.PagingFilteringContext.AllowCustomersToSelectPageSize && Model.Products.Count > 0)
                            {
                                <div class="col-md-4 pull-text-center">
                                    <div class="row">
                                        <div class="col-md-offset-2 col-md-3">
                                            <span>@T("Categories.PageSize")</span> 
                                        </div>
                                        <div class="col-md-3 remove_left_padding remove_right_padding">
                                           @Html.DropDownList("products-pagesize", Model.PagingFilteringContext.PageSizeOptions, new { @class = "form-control dropdown-filter", onchange = "setLocation(this.value);" })
                                        </div>
                                        <div class="col-md-4 remove_left_padding">
                                            <span>@T("Categories.PageSize.PerPage")</span>
                                        </div>
                                    </div>
                                </div>
                            }
                        </div>
                       


                    </div>
                    
                </div>

  

                @Html.Widget("categorydetails_before_filters")
        @section left
        {
            <div class="product-filters-wrapper">
                @*filtering*@
                @if (Model.PagingFilteringContext.PriceRangeFilter.Enabled)
                {
                    @Html.Partial("_FilterPriceBox", Model.PagingFilteringContext.PriceRangeFilter, new ViewDataDictionary())
                }
                @*filtering*@
                @if (Model.PagingFilteringContext.SpecificationFilter.Enabled)
                {
                    @Html.Partial("_FilterSpecsBox", Model.PagingFilteringContext.SpecificationFilter, new ViewDataDictionary())
                }
            </div>
        }
        @Html.Widget("categorydetails_before_product_list")
        @*product list*@
        @if (Model.Products.Count > 0)
        {
            if (Model.PagingFilteringContext.ViewMode == "list")
            {
            @*list mode*@
                <div class="product-list">
                    
                    @foreach (var product in Model.Products)
                    {
                        <div class="row">
                            
                        
                            <div class="col-md-12">
                                <div class="offer offer-default">
                                    @Html.Partial("_ProductBox", product)
                                </div>
                            </div>
                        </div>

                        
                    }
                </div>       
            }
            else
            {
            @*grid mode*@
                <div class="product-grid home-page-product-grid">
                    @{
                        var pg_i = 0;
                    }
                    @foreach (var product in Model.Products)
                    {
                        if(pg_i%3==0)
                        {
                            @:<div class="row box-products">
                        }
                        
                            <div class="col-md-4">
                                <div class="offer offer-default silde-show-offer pull-text-center">
                                    @Html.Partial("_ProductBox", product)
                                </div>
                            </div>
                        if(pg_i%3==2)
                        {
                            @:</div>
                        }

                        pg_i++;
                    }
                    @if(pg_i%3!=0)
                        {
                            @:</div>
                        }

                </div>
            }
        }
        <div class="pager">
            @Html.Pager(Model.PagingFilteringContext).QueryParam("pagenumber")
        </div>
        @Html.Widget("categorydetails_bottom")
    </div>
        </div>
    
    </div>

    
    
</div>
